package com.itheima.controller;

public class TestString2 {
    public static void main(String[] args){
        String str = "hhhkkkddd";
        int dd = theWayThird(str, "dd");
        System.out.println(dd);
    }
    public static int theWayThird(String str,String s){

        String[] split = str.split(s);
        int zonglength = str.length();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < split.length; i++) {
            sb.append(split[i]);
        }
        return (zonglength-sb.length())/(s.length());
    }
}
